#include "mainwindow.h"
#include "ui_mainwindow.h"

#include <QProcess>

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    // 绑定信号与槽函数
    connect(ui->cancelButton, SIGNAL(click()), this, SLOT(on_cancelButton_clicked()));

    connect(ui->browserButton, &QPushButton::clicked, this, &MainWindow::on_browserButton_clicked);
}

MainWindow::~MainWindow()
{
    delete ui;
}


void MainWindow::on_okButton_clicked()
{
    QString cmd = ui->cmdLineEdit->text();
    qInfo(cmd.toStdString().c_str());

    QProcess *myProcess = new QProcess(this);
    myProcess->start(cmd);

}

void MainWindow::on_cancelButton_clicked()
{

    this->close();

}


void MainWindow::on_browserButton_clicked()
{

    this->close();

}
